<?php

/**
 * Test filter form.
 *
 * @package    elearning
 * @subpackage filter
 * @author     Your name here
 */
class TestFormFilter extends BaseTestFormFilter
{
  public function configure()
  {
  	
  	$this->widgetSchema['test_status'] = new sfWidgetFormChoice(array(
	            'choices' => TestPeer::getTestStatusChoices(),
				'expanded' => true,
	        ));
	
	$this->validatorSchema['test_status'] = new sfValidatorChoice(array(
	                'required'      => false,
	                'choices'       => array_keys(TestPeer::getTestStatusChoices()),
	        ));
	//$this->setdefault[]
	//$this->setDefaults( array('test_status' => null ) );
    $this->widgetSchema->setNameFormat('test_filters[%s]');		
	
  }
  /*
	public function getFields() {
		$fields = parent::getFields();
		$fields['test_status'] = 'test_status';
		return $fields;
  	}
	*/
/*
public function addVirtualColumnColumnCriteria($q, $element, $value) {
     switch($value) {
       case 0:
			   // it doesn't do anything
			   return;
			   break;
	   case 1:
	
			   // here we can do anything: join, multiple condition, etc...
			   return $q->add(TableNamePeer::COLUMN_NAME, $value);
			   break;
     }
}
*/

 public function getFields()
  {
	return array(
	  'id'               => 'Number',
	  'level_id'         => 'ForeignKey',
	  'teacher_id'       => 'ForeignKey',
	  'test_code'        => 'Text',
	  'test_durarion'    => 'Number',
	  'test_status'      => 'ForeignKey',
	  'test_description' => 'Text',
	  'created_at'       => 'Date',
	  'updated_at'       => 'Date',
	);
  }
}
